package cn.edu.zut.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import cn.edu.zut.domain.LoginLog;


@Repository
public class LoginLogDao {
    private JdbcTemplate jdbcTemplate;

    //保存登录日志SQL
    private final static String INSERT_LOGIN_LOG_SQL=" INSERT INTO t_login_log(employee_id,ip,login_datetime) VALUES(?,?,?) ";

    public void insertLoginLog(LoginLog loginLog){
        Object[] args = { loginLog.getEmployeeId(), loginLog.getIp(), loginLog.getLoginDate()};
        jdbcTemplate.update(INSERT_LOGIN_LOG_SQL, args);

    }

    @Autowired
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate){
        this.jdbcTemplate = jdbcTemplate;
    }
}
